Functions


Determining the Caret Position, and Selecting and Highlighting Text

CharToPixel Returns the screen pixel width from the left edge of a text segment to the glyph of the character whose byte offset you specify.
HiliteText Finds all the characters between two byte offsets in a text segment whose glyphs are to be highlighted.
PixelToChar Returns the byte offset of a character in a style run, or part of a style run, whose onscreen glyph is nearest the place where the user clicked the mouse.

Drawing Text

DrawChar Draws the glyph for a single 1-byte character at the current pen location in the current graphics port.
DrawJustified Draws the specified text at the current pen location in the current graphics port, taking into account the adjustment necessary to condense or extend the text by the slop value, appropriately for the script system.
DrawString Draws the text of the specified Pascal string at the pen location in the current graphics port (GrafPort or CGrafPort).
DrawText Draws the specified text at the current pen location in the current graphics port.

Laying Out a Line of Text

GetFormatOrder Determines the display order display order of style runs for a line of text containing multiple style runs with mixed directions.
PortionLine Determines the correct proportion of extra space to apply to the specified style run in a line of justified text; that is, how to distribute the total slop value for a line among the style runs on that line.
VisibleLength Calculates the length, in bytes, of a given text segment, excluding trailing white space.

Low-Level QuickDraw Text Functions

StdText Draws text from an arbitrary structure in memory specified by textBuf, starting from the first byte and continuing for count bytes. This is the standard low-level function for drawing text.
StdTxMeas Measures the width of scaled or unscaled text.

Measuring Text

CharWidth Returns the width (horizontel extension), in pixels, of the specified character.
MeasureJustified Calculates, for text that is expanded, condensed, or scaled, the onscreen width in pixels from the left edge of the text segment to the glyph of the character.
MeasureText Provides an array version of the TextWidth function. For each character in the specified text, MeasureText calculates the width of the character’s glyph in pixels from the left edge of the text segment.
StringWidth Returns the length, in pixels, of the specified text string.
TextWidth Returns the length, in pixels, of the specified text.

Setting Text Characteristics

CharExtra Specifies, for a color graphics port (CGrafPort), the number of pixels by which to widen (or narrow) the glyphs of each nonspace character in a style run.
GetFontInfo Returns information about the current graphics port’s font, taking into account the style and size in which the glyphs are to be drawn.
SpaceExtra Specifies the number of pixels by which to widen (or narrow) each space in a style run to be drawn in the current graphics port.
TextFace Sets the style of the font in which the text is to be drawn in the current graphics port.
TextFont Sets the font of the current graphics port in which the text is to be rendered.
TextMode Sets the transfer mode for drawing text in the current graphics port.
TextSize Sets the font size for text drawn in the current graphics port to the specified number of points.

Miscellaneous

CallStyleRunDirectionProc
Char2Pixel
DisposeStyleRunDirectionUPP
DrawJust
InvokeStyleRunDirectionUPP
MeasureJust
NewStyleRunDirectionProc
NewStyleRunDirectionUPP
Pixel2Char
PortionText
StandardGlyphs
drawstring
stdtext
stringwidth

© 2000 Apple Computer, Inc. — (Last Updated 4/4/2000)